/**
 * Created by chenke on 2017/5/16.
 */
$(document).ready(function(){
    //    登录
    $(".log-btn-ck").click(function(){
        /* window.location.href = './index-lmh.html';*/
        var name = $(".username").val(),
            pass = $(".userpass").val();
        var nonehtml = "";
        //console.log(name);
        //console.log(pass);
//        查询user是否存在
        $.ajax({
            type:"post",
            url:"/postloginuser_PC",
            data:{text1:name,text2:pass},
            success:function(data){
                if(data.length > 0){
                    window.location.href = '../../index.html';
                }else{
                    $('.tipdiv').append(
                        '<div class="alert alert-danger alert-dismissible fade in" role="alert" ' +
                        ' style="  margin-top: 10px; margin-right: -20px;margin-left: 20px;"> ' +
                        '<button type="button" class="close" data-dismiss="alert" aria-label="Close">' +
                        '<span aria-hidden="true">×</span></button>' +
                        '登录提示:用户名或密码错误。</div>'
                    );
                    setTimeout(function(){
                        $('.tipdiv').html(nonehtml);
                    },2000)
                }
//                localstorage.setItem("name",)
            }
        });
    });
});